#include "configurations.h"

Configurations::Configurations(QSettings *settings)
{
    this->settings = settings;
    parseSettings();
}

void Configurations::parseSettings()
{
    appName = settings->value("/APP/APP_NAME").toString();
    dfCollector = settings->value("/APP/DEFAULT_DATA_COLLECTOR").toString();
    dfRTIndicatorSerial = settings->value("/APP/DEFAULT_RT_INDICATOR_SERIAL").toString().split(",");
    dfRTIndicatorUDP = settings->value("/APP/DEFAULT_RT_INDICATOR_UDP").toString().split(",");
    plotPointNum = settings->value("/APP/PLOT_POINT_NUM").toInt();
    dfMagnetic = settings->value("/APP/DEFAULT_MAGNETIC").toString().split(",");

    ip = settings->value("/UDP_SERVER/IP").toString();
    port = settings->value("/UDP_SERVER/PORT").toInt();
    timeout = settings->value("/UDP_SERVER/TIMEOUT").toInt();

    serialNum = settings->value("/SERIAL/SERIAL_NUM").toString();
    baudRate = settings->value("/SERIAL/BAUD_RATE").toInt();
    parity = settings->value("/SERIAL/PARITY").toString();
    dataBit = settings->value("/SERIAL/DATA_BIT").toInt();
    stopBit = settings->value("/SERIAL/STOP_BIT").toString();
    startCMD =  settings->value("/SERIAL/START_CMD").toString();
    stopCMD =  settings->value("/SERIAL/STOP_CMD").toString();
    timerInterval =  settings->value("/SERIAL/TIMER_INTERVAL").toFloat();
}


